package cn.wolfcode.designpattern.factory.simplefactory;

public class PayController {

    private PaySimpleFactory simpleFactory;

    public void setSimpleFactory(PaySimpleFactory simpleFactory) {
        this.simpleFactory = simpleFactory;
    }

    public static void main(String[] args) {
        // 模拟支付
        PayController payController = new PayController();
        payController.setSimpleFactory(new PaySimpleFactory());

        payController.pay("wechat");
    }

    /**
     * 消费者
     */
    public void pay(String payType) {
        Pay pay = simpleFactory.createPay(payType);
        pay.build();
        pay.signature();
        pay.verifySignature();
        pay.payment();
    }

}

